<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
        .lx {
          text-align: center;
          letter-spacing: 5px;
          margin: 20px;
        }
      </style>
</head>
<body>
    <div class="lx">
        <script>
          // function cl() {
          //   var c = '0123456789abcdef';
          //   var cc = '#';
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));
          //   cc += c.charAt(Math.round(Math.random() * (c.length - 1)));

          //   return cc;
          // }
          function line(num) {
            for (var i = 1; i <= num; i += 2) {
              document.write('<p class="line">');
              for (var j = 1; j <= i; j++) {
                // document.write('<span style="color:' + cl() + '">*</span>');
                document.write('<span>*</span>');
                
              }
              document.write('</p>');
            }
            for (var i = num; i >= 1; i -= 2) {
              document.write('<p class="line">');
              for (var j = 1; j <= i; j++) {
                // document.write('<span style="color:' + cl() + '">*</span>');
                document.write('<span>*</span>');
              }
              document.write('</p>');
            }
          }
          //奇数
          line(11);
        </script>
      </div>
</body>
</html>